Add initial support for Nanox graphics backend for Lua#12
Conversation
|
@rafael2k is the master branch the correct one to add new functionality and the one used by the ELKS' automatic builds? |
|
@ghaerr I want to compile lua (which is compiled with owcc) together with libnano-X.a, but libnano-X.a is compiled with gcc ia 16. So is this actually possible? |
Files compiled with OWCC can't be combined/linked with IA16 objects, and vice versa; the object files themselves as well as the function calling conventions are incompatible. A few options might be either an OWCC version of the Nano-X client library (libnano-X.lib) or an ia16-elf-gcc version of LUA. The Nano-X client library communicates with the Nano-X server via a UNIX socket, so only the client library files (microwindows/src/nanox/{client.c,nxproto.c,nxutil.c,osdep.c) need to be compiled and linked with the application object files. This may not be a big deal, but would require changes to Makefile.elks on the Nano-X repo, or compiling those files along with the LUA build. The other method would compiling LUA in small model using ia16-elf-gcc. Is there a reason why LUA must be compiled large model? It would seem the cubes demo itself shouldn't require more than 64K code or data, but I haven't looked at the LUA engine to determine that. |
Yes - I chose the large model for compiling Lua for a reason. |
|
Actually the idea was to have it working from nxdsktop as a nice demo. But progress is made!!!!!!!!!!!!!!!!!!! |
|
@ghaerr I tried these in the Lua makefile: but it did not enable Maybe the fork that is done when calling it like this |
|
This is very cool!! If memory turns out to be a problem, we can use an older Lua version (some branches here...) or just trim down some modules from ELKS Lua build. |
It seems likely that's what's happening. The current fork->exec model for starting new processes with ELKS can fail when the calling process is large but there's still room in memory for the new process. I'm thinking perhaps ELKS should implement a When called from the Getting the shell to use posix_spawn could be complicated, but for programs that just want to basically execute another process and skip any In particular, the Nano-X client library uses just fork/exec and could be enhanced to use posix_spawn instead. |
|
There is already a fork optimisation using do_fork(1), but it is disabled: https://github.com/ghaerr/elks/blob/76a97d95eb923cf1a483409e7af226a62afb3c64/elks/kernel/fork.c#L158 ? So parent and child share memory with do_fork(1) ? Can it be a possible solution? |


Optional Nano-X client backend. Switches graphics from VGA to Nano-X when USE_NANOX_BACKEND = 1
NANOX_DIR must point to the Nano-X source directory containing: include/ nanox/ drivers/
Example console override:
make -f Makefile.elks USE_NANOX_BACKEND=1 NANOX_DIR=/root/microwindows/srcExample usage:
/bin/nano-x & /bin/lua /root/drawcube.lua